/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cip.esymons.tesoreria.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.eventos.bc.EventoFacadeLocal;
import org.cip.esymons.eventos.be.Evento;
import org.cip.esymons.eventos.be.Preevento;

/**
 *
 * @author Ingrid Capuñay
 */
public class EventoDelegate {

    private EventoFacadeLocal local;

    public EventoDelegate() {
        local = lookupEventoFacade();
    }

    public Evento find(Object id) {
        return local.find(id);
    }

    public List<Evento> listarEventoCurso() {
        return local.listarEventoParaCI();
    }

    //Lizardo estuvo aqui
    public List<Preevento> listarEventoCurso2() throws Exception {
        return local.listarEventoParaCI2();
    }   

    private EventoFacadeLocal lookupEventoFacade() {
        try {
            Context c = new InitialContext();
            return (EventoFacadeLocal) c.lookup("java:comp/env/EventoFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
}
